Trim string in JavaScript - Stack Overflow